package com.glitter.player.logic.controller;

import com.glitter.player.ioc.annotation.PPController;
import com.glitter.player.ioc.annotation.PPRequestMapping;
import com.glitter.player.ioc.annotation.PPRequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Description:
 * @ClassName:PPController
 * @Author:Player
 * @Date:2019-06-14 10:43
 **/
@PPController

public class Controller {

    @PPRequestMapping("/test")
    public void query(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse,
                      @PPRequestParam("name") String name) throws IOException {
        httpServletResponse.setCharacterEncoding("UTF-8");
        httpServletResponse.setContentType("text/html;charset=UTF-8");
        httpServletResponse.getWriter().write("你的名字叫"+name+"?");
    }

    @PPRequestMapping("/")
    public void index(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException {
        httpServletResponse.setCharacterEncoding("UTF-8");
        httpServletResponse.setContentType("text/html;charset=UTF-8");
        httpServletResponse.getWriter().write("欢迎使用GlitterPlayerIOC Framework");
    }

}
